#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>

int main()
{
    int sockfd;
    struct sockaddr_in servaddr;

    sockfd = socket(PF_INET, SOCK_DGRAM, 0);

    bzero(&servaddr, sizeof(servaddr));
    servaddr.sin_family = AF_INET;
    servaddr.sin_port = htons(50001);
    servaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
	
	connect(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr));
	

    char buff[100];
	fgets(buff,sizeof(buff),stdin);
	send(sockfd, buff, strlen(buff), 0);
    printf("send: %s",buff);
	
	recv(sockfd, buff, sizeof(buff), 0);
	printf("recv: %s",buff);
    close(sockfd);

    return 0;
}